package slerp;

/**
 * Class describing a chunk
 * -Members
 * -Neighbours
 * 
 **/

/**
 *
 * @author Klas
 */

import java.io.Serializable;
import java.util.ArrayList;

public class Chunk implements Serializable {
    private ArrayList<Member> members = new ArrayList<Member>();
    private ArrayList<Chunk> neighbours =  new ArrayList<Chunk>();
    
    Chunk() {

    }
    
    void addNeighbour(Chunk neighbour) {
       neighbours.add(neighbour);
    }
    
    void addMember(Member member, int position) {
       ensureCapacity(position);
       members.add(member);
    }
    
    void addMember(Member member) {
       members.add(member);
    }
    
    void debugPrintMembers() {
        for(int i=0; i<members.size(); i++) {
            members.get(i).debugPrint();
            System.out.print(". ");
        }
    }
    
    void ensureCapacity(int member) {
        while(member >= members.size()) {
            members.add(new Empty());
        }
    }
    
    
}
